Questools can be installed through github:
# devtools::install_github("bAIo-lab/Questools")
library(Questools)We’ll use a health Questionnaire dataset to work with Questools. The dataset contains 291 variables, including 36 continuous (i.e., laboratory measurements), and 255 categorical variables (i.e., questions) having no missing data.
data <- read.csv("../data/data.csv")
kableExtra::kable(head(data)) %>%
kable_styling() %>%
scroll_box(width = "100%", height = "200px")| Age | Vazn | Ghad | BMI | MetaP | CharbiE | FesharS | FesharD | Nabz | DarsadChB | DarsadAzB | DorBadan | DorBasan | DorGardan | FSG | Urea | UAC | Chol | TG | Crea | LDH | CBC | WBC | RBC | HB | Hct | MCV | MCH | MCHC | Platelet | Lymph | Mxd | Neut | RDW | PDW | MPV | test1 | test2 | test3 | test4 | test5 | test6 | test7 | test8 | test9 | test10 | test11 | test12 | test13 | test14 | test15 | test16 | test17 | test18 | test19 | test20 | test21 | test22 | test23 | test24 | test25 | test26 | test27 | test28 | test29 | test30 | test31 | test32 | test33 | test34 | test35 | test36 | test37 | test38 | test39 | test40 | test41 | test42 | test43 | test44 | test45 | test46 | test47 | test48 | test49 | test50 | test51 | test52 | test53 | test54 | test55 | test56 | test57 | test58 | test59 | test60 | test61 | test62 | test63 | test64 | test65 | test66 | test67 | test68 | test69 | test70 | test71 | test72 | test73 | test74 | test75 | test76 | test77 | test78 | test79 | test80 | test81 | test82 | test83 | test84 | test85 | test86 | test87 | test88 | test89 | test90 | test91 | test92 | test93 | test94 | test95 | test96 | test97 | test98 | test99 | test100 | test101 | test102 | test103 | test104 | test105 | test106 | test107 | test108 | test109 | test110 | test111 | test112 | test113 | test114 | test115 | test116 | test117 | test118 | test119 | test120 | test121 | test122 | test123 | test124 | test125 | test126 | test127 | test128 | test129 | test130 | test131 | test132 | test133 | test134 | test135 | test136 | test137 | test138 | test139 | test140 | test141 | test142 | test143 | test144 | test145 | test146 | test147 | test148 | test149 | test150 | test151 | test152 | test153 | test154 | test155 | test156 | test157 | test158 | test159 | test160 | test161 | test162 | test163 | test164 | test165 | test166 | test167 | test168 | test169 | test170 | test171 | test172 | test173 | test174 | test175 | test176 | test177 | test178 | test179 | test180 | test181 | test182 | test183 | test184 | test185 | test186 | test187 | test188 | test189 | test190 | test191 | test192 | test193 | test194 | test195 | test196 | test197 | test198 | test199 | test200 | test201 | test202 | test203 | test204 | test205 | test206 | test207 | test208 | test209 | test210 | test211 | test212 | test213 | test214 | test215 | test216 | test217 | test218 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 55 | 114.7 | 163 | 43.0 | 1868 | 15 | 137 | 76 | 62 | 55.0 | 20.0 | 121 | 149 | 37 | 129.0000 | 38.00000 | 4.100000 | 250.0000 | 131.0000 | 0.700000 | 75.00000 | 5416.166 | 6300.000 | 4.85 | 13.80 | 41.3 | 85.2 | 28.5 | 33.4 | 268000.0 | 38.1 | 10.1 | 51.8 | 13.5 | 11.1 | 8.8 | 4 | 2 | 5 | 1 | 1 | 1 | 1 | 1 | 3 | 2 | 5 | 1 | 5 | 1 | 4 | 4 | 5 | 2 | 1 | 2 | 3 | 5 | 4 | 4 | 4 | 3 | 2 | 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 1 | 2 | 3 | 4 | 5 | 2 |
Use dim.reduce to visualize the continuous variables in 2 dimensions with tsne.
#dim.reduce(data[,1:36], method = "tsne") -> plt
#pltUse ggm to construct a Gaussian Graphical Model with glasso and significance test method.
ggm(data[,1:36], significance = 0.05, rho = 0.1, community = TRUE, methods = c("glasso", "sin")) -> g
g$networkg## $graph
## IGRAPH e5fcce4 UN-- 36 76 --
## + attr: label_1 (v/c), label_2 (v/c), name (v/c), weight_1 (e/n),
## | weight_2 (e/n)
## + edges from e5fcce4 (vertex names):
## [1] PDW --MPV RDW --MPV Mxd --Neut
## [4] Lymph --RDW Platelet--MPV Platelet--Mxd
## [7] MCHC --Mxd MCH --RDW MCH --Neut
## [10] MCH --Mxd MCH --Lymph MCH --Platelet
## [13] MCV --Mxd MCV --Lymph MCV --MCHC
## [16] Hct --Mxd Hct --Platelet Hct --MCHC
## [19] HB --RDW HB --MCHC HB --MCV
## + ... omitted several edges
##
## $betweenness
## Age Vazn Ghad BMI MetaP CharbiE
## 267.9166667 9.9880952 94.7738095 6.6190476 3.5833333 108.8928571
## FesharS FesharD Nabz DarsadChB DarsadAzB DorBadan
## 33.0000000 0.0000000 0.0000000 6.7857143 0.3333333 6.0357143
## DorBasan DorGardan FSG Urea UAC Chol
## 0.8333333 8.2380952 273.0000000 0.0000000 143.5000000 0.0000000
## TG Crea LDH CBC WBC RBC
## 282.5000000 33.0000000 128.5000000 1.3095238 14.1666667 15.0000000
## HB Hct MCV MCH MCHC Platelet
## 16.5190476 6.9166667 5.4952381 38.3523810 6.4023810 124.7595238
## Lymph Mxd Neut RDW PDW MPV
## 6.1666667 22.4523810 1.1166667 121.8428571 283.5000000 273.5000000
##
## $network
Use bn to learn the structure of a Bayesian network fitting data with si.hito.pc as a Constraint-based algorithm, mmhc as a Hybrid algorithm, and tabu as a Score-based algorithm. Repeat the bootstrap sampling 100 times. (very time consuming)
bn(data = data[,1:36], C.alg = c("si.hiton.pc"), S.alg = c("mmhc", "tabu"), blacklist = data.frame(to = "BMI", to = "Age"), R = 10, community = FALSE, str.thresh = 0.9, dir.thresh = 0.5) -> n
n$networkn## $graph
## from to strength direction
## 5 Age CharbiE 1.0 0.9000000
## 6 Age FesharS 1.0 0.8000000
## 14 Age FSG 1.0 0.3000000
## 38 Vazn BMI 1.0 0.5500000
## 39 Vazn MetaP 1.0 0.8500000
## 40 Vazn CharbiE 1.0 0.9000000
## 46 Vazn DorBadan 1.0 1.0000000
## 47 Vazn DorBasan 1.0 1.0000000
## 79 Ghad DarsadChB 1.0 0.2000000
## 83 Ghad DorGardan 0.9 1.0000000
## 110 BMI CharbiE 1.0 0.4000000
## 114 BMI DarsadChB 1.0 1.0000000
## 180 CharbiE MetaP 1.0 0.8000000
## 181 CharbiE FesharS 0.9 1.0000000
## 186 CharbiE DorBadan 1.0 0.8000000
## 217 FesharS FesharD 1.0 0.9000000
## 318 DarsadChB Ghad 1.0 0.8000000
## 327 DarsadChB DorBasan 1.0 1.0000000
## 355 DarsadAzB MetaP 1.0 0.8000000
## 360 DarsadAzB DarsadChB 1.0 0.7000000
## 397 DorBadan DorBasan 1.0 1.0000000
## 398 DorBadan DorGardan 1.0 1.0000000
## 462 DorGardan FesharS 0.9 0.7777778
## 468 DorGardan DorBasan 1.0 1.0000000
## 497 FSG FesharS 1.0 0.9000000
## 526 Urea Age 1.0 0.8000000
## 540 Urea FSG 0.9 0.5555556
## 575 UAC FSG 1.0 0.4500000
## 579 UAC Crea 1.0 0.6500000
## 585 UAC Hct 0.9 0.7777778
## 594 UAC PDW 0.9 0.3888889
## 596 Chol Age 1.0 1.0000000
## 613 Chol TG 1.0 0.5500000
## 615 Chol LDH 1.0 0.8000000
## 645 TG FSG 1.0 0.7500000
## 647 TG UAC 1.0 0.8500000
## 648 TG Chol 1.0 0.4500000
## 650 TG LDH 1.0 0.7000000
## 652 TG WBC 0.9 1.0000000
## 675 Crea DarsadChB 1.0 0.7000000
## 681 Crea Urea 1.0 0.8000000
## 690 Crea Hct 0.8 0.8125000
## 699 Crea PDW 0.8 0.3750000
## 827 RBC CBC 1.0 0.6000000
## 832 RBC MCH 1.0 0.3500000
## 835 RBC Lymph 1.0 0.7500000
## 838 RBC RDW 1.0 1.0000000
## 863 HB WBC 1.0 1.0000000
## 865 HB Hct 1.0 0.9500000
## 866 HB MCV 1.0 0.2000000
## 941 MCV Mxd 1.0 0.5500000
## 977 MCH Neut 1.0 0.3000000
## 1117 Mxd Neut 1.0 0.6000000
## 1143 Neut WBC 1.0 0.8000000
## 1211 PDW LDH 0.9 0.7222222
## 1225 PDW MPV 1.0 0.8000000
## 1259 MPV RDW 1.0 0.6000000
##
## $network
Employ min.forest with BIC to construct a mixed-interaction model fitting the data.
min.forest(data, stat = "BIC", community = TRUE) -> mf
mf$networkmf## $summary
## gRapHD object
## Number of edges = 1001
## Number of vertices = 254
## Model = continuous
## Statistic (minForest) = BIC
## Statistic (stepw) = BIC
## Statistic (user def.) =
## Edges (minForest) = 1...253
## Edges (stepw) = 254...1001
## Edges (user def.) = 1...253
##
##
## $betweenness
## Age test1 Hct HB RBC
## 5.020000e+02 1.139947e+04 1.549206e+00 2.680199e+02 2.589709e+02
## Lymph MCH RDW Mxd MCV
## 0.000000e+00 1.520735e+02 1.714009e+02 2.930952e+00 4.196755e+02
## MCHC test156 test155 Neut CBC
## 2.154365e+00 1.255000e+02 1.255000e+02 0.000000e+00 1.306940e+02
## test168 test169 test55 test56 test148
## 1.006624e+01 2.107556e+02 1.160397e+04 0.000000e+00 1.678333e+02
## test147 Platelet test115 test118 test9
## 0.000000e+00 0.000000e+00 1.369430e+03 0.000000e+00 8.471903e+01
## FesharS test107 test109 WBC DorBadan
## 1.922778e+02 2.469405e+02 4.354875e+01 1.428571e-01 7.078053e+02
## DorBasan test121 test123 BMI test11
## 2.324816e+02 5.501543e+02 4.008822e+01 2.901087e+02 0.000000e+00
## test89 test90 test67 test66 CharbiE
## 1.916419e+03 0.000000e+00 2.115667e+02 3.650000e+00 7.975781e+02
## PDW MPV test116 Vazn DarsadChB
## 3.105380e+02 1.404977e+02 3.333333e-01 1.338376e+03 1.048889e+03
## test10 FesharD DarsadAzB test23 test21
## 3.333333e-01 0.000000e+00 3.068576e+03 5.781621e+02 0.000000e+00
## test93 test96 test62 test64 test2
## 2.333333e+00 0.000000e+00 2.390799e+03 5.372167e+02 4.499763e+03
## test102 test104 Crea UAC test131
## 7.623790e+02 0.000000e+00 1.489056e+02 5.864777e+02 3.333333e-01
## test130 test184 test183 test80 test81
## 0.000000e+00 6.665271e+02 1.229430e+01 2.211805e+03 2.250000e+00
## test71 test72 test182 test45 test43
## 7.059152e+02 0.000000e+00 1.883781e+02 4.001539e+02 4.107369e+02
## test61 test59 test94 MetaP test154
## 5.506635e+02 2.937909e+03 6.132332e+02 3.633254e+00 0.000000e+00
## test60 test47 test52 test57 test108
## 5.934584e+03 8.536685e+01 1.233075e+03 1.205387e+03 0.000000e+00
## test54 DorGardan test5 test4 test58
## 2.530774e+03 1.870166e+03 0.000000e+00 1.217121e+01 1.236246e+03
## test138 test139 test167 test166 Ghad
## 6.733333e+00 1.776500e+02 4.189404e+01 0.000000e+00 5.141695e+00
## test6 test98 test100 test75 test76
## 5.445673e+02 1.960000e+03 0.000000e+00 2.520000e+02 0.000000e+00
## test44 test53 test124 test49 test41
## 5.423093e+01 1.300473e+02 0.000000e+00 0.000000e+00 1.804463e+03
## test161 test160 test152 test150 test33
## 0.000000e+00 0.000000e+00 1.246000e+03 0.000000e+00 3.050347e+01
## test40 test203 test204 test111 test113
## 3.256479e+01 5.538252e+02 7.686407e+01 4.932429e+03 0.000000e+00
## test105 Urea test122 test95 test172
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 8.094780e+02
## test46 test202 test35 test171 test170
## 0.000000e+00 2.903914e+02 1.047044e+03 9.824804e+00 1.886648e+01
## test132 test158 test159 test38 test74
## 2.523333e+02 1.606107e+01 0.000000e+00 5.227475e+02 0.000000e+00
## test205 test39 test99 test36 test103
## 7.537114e+01 9.666856e+01 1.482000e+03 2.006977e+03 0.000000e+00
## test51 test50 test65 test48 test34
## 3.615653e+03 3.358870e+01 9.066667e+00 5.059600e+02 0.000000e+00
## test146 test42 test25 test142 test143
## 3.351667e+02 1.926726e+01 2.746363e+00 2.932883e+03 1.575483e+03
## test185 test162 test163 test198 test85
## 2.520000e+02 5.020000e+02 5.981757e+02 6.106198e+02 3.078938e+01
## test164 test165 test37 test112 test19
## 2.520000e+02 0.000000e+00 0.000000e+00 4.872000e+03 6.129036e+01
## test127 test128 test178 test177 test83
## 1.691167e+02 0.000000e+00 3.225541e+01 3.731129e+00 2.483333e+00
## test201 test18 test125 TG Chol
## 0.000000e+00 1.820096e+02 5.791127e+01 0.000000e+00 0.000000e+00
## test151 FSG test206 test69 test134
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.813500e+02
## test135 test24 test12 test13 test92
## 1.065900e+03 2.049665e+02 1.153059e+02 0.000000e+00 1.441131e+03
## test88 test26 test186 test117 test119
## 0.000000e+00 0.000000e+00 1.798380e+02 0.000000e+00 1.593870e+02
## test78 test14 test16 test22 test110
## 0.000000e+00 2.610661e+02 1.048874e+01 4.343678e+02 0.000000e+00
## test15 test17 test3 test174 test120
## 2.046063e+02 0.000000e+00 2.978758e+02 2.236597e+03 0.000000e+00
## test68 test84 test215 test173 test216
## 2.500000e-01 2.066667e+00 5.000000e-01 5.611173e+01 1.357381e+02
## test82 test218 test213 test194 test190
## 0.000000e+00 2.879051e+02 5.902931e+01 4.651234e+02 2.162900e+02
## test136 test211 LDH test87 test106
## 6.250000e+00 4.520202e-01 2.151969e+02 0.000000e+00 2.000000e+00
## test175 test176 test180 test30 test29
## 2.520000e+02 0.000000e+00 1.324505e+02 5.062534e+00 3.611111e-01
## test144 test199 test140 test126 test197
## 0.000000e+00 6.752106e+01 8.008333e+01 8.283333e+01 6.592891e+02
## test70 test91 test208 test73 test200
## 6.976161e+01 2.426914e+01 1.173391e+02 0.000000e+00 5.380347e+02
## test63 test28 test193 test192 test179
## 3.333333e-01 4.832816e+02 3.333333e-01 1.166667e+00 0.000000e+00
## test101 test209 test188 test189 test191
## 1.960919e+02 0.000000e+00 1.158810e+03 6.541991e+01 0.000000e+00
## test79 test20 test207 test97 test31
## 2.120539e+02 0.000000e+00 0.000000e+00 1.371001e+02 0.000000e+00
## test32 test114 test196 test195 test212
## 0.000000e+00 3.778014e+02 1.607576e+00 0.000000e+00 3.940397e+00
## test210 test86 test217 test145 test77
## 0.000000e+00 1.416667e+00 0.000000e+00 7.863333e+02 5.190811e+01
## test8 test214 test137 test153 test7
## 0.000000e+00 0.000000e+00 2.066667e+02 0.000000e+00 0.000000e+00
## test141 test187 test133 test27 test181
## 1.482000e+03 5.694024e+02 0.000000e+00 0.000000e+00 0.000000e+00
## Nabz test149 test157 test129
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
##
## $network
Use div with 1000 times of permutation to find the most deferentially answered questions between people with answer “1” to the test 62 and people with answer “2” to the test 62. (Test 62 is about cardiovascular diseases.)
g1 <- which(data$test62 == "1")
g2 <- which(data$test62 == "2")
div(data[37:dim(data)[2]], g1, g2, permute = 1000) -> KL
KL$name <- row.names(KL)
KL <- KL %>% arrange(desc(KL))
kableExtra::kable(head(KL,n = 20)) %>%
kable_styling() %>%
scroll_box(width = "400px", height = "400px")| KL | p.value | name |
|---|---|---|
| 15.7933761 | 0.01 | test62 |
| 4.6857327 | 0.01 | test65 |
| 4.2716551 | 0.01 | test63 |
| 3.6990622 | 0.01 | test64 |
| 2.2007322 | 0.01 | test67 |
| 1.8612079 | 0.01 | test66 |
| 0.9330294 | 0.01 | test168 |
| 0.9090498 | 0.01 | test1 |
| 0.8622886 | 0.01 | test169 |
| 0.6740090 | 0.01 | test69 |
| 0.5740225 | 0.01 | test71 |
| 0.5268477 | 0.01 | test174 |
| 0.4537840 | 0.01 | test68 |
| 0.4197713 | 0.01 | test54 |
| 0.4043018 | 0.01 | test57 |
| 0.3865165 | 0.01 | test178 |
| 0.3788912 | 0.01 | test184 |
| 0.3759118 | 0.01 | test73 |
| 0.3699828 | 0.01 | test89 |
| 0.3543039 | 0.01 | test80 |
Use div2 to find the most deferentially answered questions between people with relatively high BMI (relative to blood pressure) and people with high pressure (relative to BMI). (FesharS demonstrates blood pressure.)
div2(data[37:dim(data)[2]], var1 = data$BMI, var2 = data$FesharS, permute = 0) -> KL
KL$name <- row.names(KL)
KL <- KL %>% arrange(desc(KL))
kableExtra::kable(head(KL, n = 20)) %>%
kable_styling() %>%
scroll_box(width = "300px", height = "400px")| KL | name |
|---|---|
| 5.8395634 | test11 |
| 0.7040959 | test1 |
| 0.5497792 | test2 |
| 0.4742267 | test8 |
| 0.4487907 | test172 |
| 0.3703050 | test89 |
| 0.3502208 | test174 |
| 0.3422061 | test121 |
| 0.3240845 | test78 |
| 0.3101447 | test56 |
| 0.3010604 | test55 |
| 0.2995396 | test71 |
| 0.2895905 | test178 |
| 0.2648403 | test57 |
| 0.2594900 | test124 |
| 0.2542359 | test6 |
| 0.2417774 | test74 |
| 0.2400237 | test80 |
| 0.2140980 | test91 |
| 0.2092262 | test195 |
Use plot for different visualizations. levels is set to 10 to capture categorical variables.
Histogram for test 10:
plot(data, vars = c("test10"), levels = 10)Density plot for BMI:pl
plot(data, vars = c("BMI"), levels = 10)Boxplot of BMI for different answers of test 1:
plot(data, vars = c("test1", "BMI"), levels = 10)Relative histogram of test 1 vs test 10:
plot(data, vars = c("test1", "test10"), levels = 10)Scatter plot of Vazn (weight) vs BMI:
plot(data, vars = c("Vazn", "BMI"), levels = 10)Pie chart of test 1:
plot(data, vars = c("test1"), levels = 10, pie = TRUE)